﻿@using PlatformNetCore.Entity
@{
    ViewBag.Title = "新增导航栏";
}
@model Menu
<style>
    html {
        background-color: #fff;
    }

    .layui-card {
        box-shadow: none;
    }
</style>

<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="@Url.Action("MenuAdd","Basis",new { area = "Admin"})" lay-filter="useradd-form">
            <div class="layui-form-item">
                <label class="layui-form-label">导航名称*</label>
                <div class="layui-input-block">
                    <input type="text" name="Title" lay-verify="required" placeholder="导航名称" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">代码*</label>
                <div class="layui-input-block">
                    <input type="text" name="MenuCode" lay-verify="required" placeholder="代码（必填）" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">所属分类*</label>
                <div class="layui-input-block">
                    <select name="MenuType" lay-filter="MenuType">
                        @foreach (var item in (IEnumerable<SelectListItem>)ViewBag.MenuTypeDLL)
                        {
                            <option value="@item.Value">@item.Text</option>
                        }
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上级菜单</label>
                <div class="layui-input-block">
                    <select name="ParentID" lay-filter="ParentID">
                        @foreach (var item in (IEnumerable<SelectListItem>)ViewBag.MenuListDLL)
                        {
                            <option value="@item.Value">@item.Text</option>
                        }
                    </select>
                </div>
            </div>
            <div class="layui-form-item" id="previewImage">
                <label class="layui-form-label">链接</label>
                <div class="layui-input-block">
                    <input type="text" name="Link" placeholder="链接" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
                    <textarea type="text" class="layui-textarea" name="Remark" placeholder="描述"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">SEO标题</label>
                <div class="layui-input-block">
                    <input type="text" name="SEOTitle" placeholder="SEO标题" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">SEO关键字</label>
                <div class="layui-input-block">
                    <input type="text" name="SEOKeyword" placeholder="SEO关键字" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">SEO描述</label>
                <div class="layui-input-block">
                    <textarea type="text" class="layui-textarea" name="SEODescription" placeholder="SEO描述"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序号</label>
                <div class="layui-input-block">
                    <input type="text" name="SortNo" value="1000" lay-verify="required" placeholder="排序号" autocomplete="on" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否显示</label>
                <div class="layui-input-block">
                    <input type="checkbox" checked="" name="IsAvailable" value="1" lay-skin="switch" lay-filter="available-Switch" lay-text="显示|隐藏">
                </div>
            </div>
            <div id="useradd-submit" lay-submit lay-filter="useradd-submit"></div>
        </form>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var $ = layui.$, form = layui.form;
        
        form.render(null, 'useradd-form');

        /* 监听指定开关 */
        form.on('switch(available-Switch)', function (data) {
            $(this).val(this.checked ? '1' : '0')
        });

    });
</script>
